package com.zongxingh.falcon.mq.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Introduction:  <简介>
 * Package Name:  com.zongxingh.falcon.mq.config
 * Project Name:  mq
 * Author:  zongxingh
 * Email： zongxingh@163.com
 * Tel: 157*****778
 * Create Time:  2020/10/14 16:46
 */
@Component
@ConfigurationProperties(prefix = MqProperties.PREFIX)
public class MqProperties {
    public static final String PREFIX = "falcon.mq";

    private String mqType;

    private Rabbitmq rabbitmq;

    private Rocketmq rocketmq;

    public Rabbitmq getRabbitmq() {
        return rabbitmq;
    }

    public Rocketmq getRocketmq() {
        return rocketmq;
    }

    public void setRabbitmq(Rabbitmq rabbitmq) {
        this.rabbitmq = rabbitmq;
    }

    public void setRocketmq(Rocketmq rocketmq) {
        this.rocketmq = rocketmq;
    }

    public String getMqType() {
        return mqType;
    }

    public void setMqType(String mqType) {
        this.mqType = mqType;
    }

    public class Rocketmq{
        private String namesrvAddr;
        private String clientIp;
        private String instanceName;
        private int clientCallbackExecutorThreads;
        private long pollNameServerInteval;
        private long heartbeatBrokerInterval;
        private long persistConsumerOffsetInterval;

        private Producer producer;
        private PushConsumer pushConsumer;

        public String getNamesrvAddr() {
            return namesrvAddr;
        }

        public void setNamesrvAddr(String namesrvAddr) {
            this.namesrvAddr = namesrvAddr;
        }

        public String getClientIp() {
            return clientIp;
        }

        public void setClientIp(String clientIp) {
            this.clientIp = clientIp;
        }

        public String getInstanceName() {
            return instanceName;
        }

        public void setInstanceName(String instanceName) {
            this.instanceName = instanceName;
        }

        public int getClientCallbackExecutorThreads() {
            return clientCallbackExecutorThreads;
        }

        public void setClientCallbackExecutorThreads(int clientCallbackExecutorThreads) {
            this.clientCallbackExecutorThreads = clientCallbackExecutorThreads;
        }

        public long getPollNameServerInteval() {
            return pollNameServerInteval;
        }

        public void setPollNameServerInteval(long pollNameServerInteval) {
            this.pollNameServerInteval = pollNameServerInteval;
        }

        public long getHeartbeatBrokerInterval() {
            return heartbeatBrokerInterval;
        }

        public void setHeartbeatBrokerInterval(long heartbeatBrokerInterval) {
            this.heartbeatBrokerInterval = heartbeatBrokerInterval;
        }

        public long getPersistConsumerOffsetInterval() {
            return persistConsumerOffsetInterval;
        }

        public void setPersistConsumerOffsetInterval(long persistConsumerOffsetInterval) {
            this.persistConsumerOffsetInterval = persistConsumerOffsetInterval;
        }

        public Producer getProducer() {
            return producer;
        }

        public void setProducer(Producer producer) {
            this.producer = producer;
        }

        public PushConsumer getPushConsumer() {
            return pushConsumer;
        }

        public void setPushConsumer(PushConsumer pushConsumer) {
            this.pushConsumer = pushConsumer;
        }

        public class Producer{
            private String producerGroup;
            private String createTopicKey;
            private int defaultTopicQueueNums;
            private long sendMsgTimeout;
            private int compressMsgBodyOverHowmuch;
            private boolean retryAnotherBrokerWhenNotStoreOk;
            private int retryTimesWhenSendFailed;
            private String maxMessageSize;
            private int checkThreadPoolMinSize;
            private int checkThreadPoolMaxSize;
            private int checkRequestHoldMax;

            public String getProducerGroup() {
                return producerGroup;
            }

            public void setProducerGroup(String producerGroup) {
                this.producerGroup = producerGroup;
            }

            public String getCreateTopicKey() {
                return createTopicKey;
            }

            public void setCreateTopicKey(String createTopicKey) {
                this.createTopicKey = createTopicKey;
            }

            public int getDefaultTopicQueueNums() {
                return defaultTopicQueueNums;
            }

            public void setDefaultTopicQueueNums(int defaultTopicQueueNums) {
                this.defaultTopicQueueNums = defaultTopicQueueNums;
            }

            public long getSendMsgTimeout() {
                return sendMsgTimeout;
            }

            public void setSendMsgTimeout(long sendMsgTimeout) {
                this.sendMsgTimeout = sendMsgTimeout;
            }

            public int getCompressMsgBodyOverHowmuch() {
                return compressMsgBodyOverHowmuch;
            }

            public void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch) {
                this.compressMsgBodyOverHowmuch = compressMsgBodyOverHowmuch;
            }

            public boolean isRetryAnotherBrokerWhenNotStoreOk() {
                return retryAnotherBrokerWhenNotStoreOk;
            }

            public void setRetryAnotherBrokerWhenNotStoreOk(boolean retryAnotherBrokerWhenNotStoreOk) {
                this.retryAnotherBrokerWhenNotStoreOk = retryAnotherBrokerWhenNotStoreOk;
            }

            public int getRetryTimesWhenSendFailed() {
                return retryTimesWhenSendFailed;
            }

            public void setRetryTimesWhenSendFailed(int retryTimesWhenSendFailed) {
                this.retryTimesWhenSendFailed = retryTimesWhenSendFailed;
            }

            public String getMaxMessageSize() {
                return maxMessageSize;
            }

            public void setMaxMessageSize(String maxMessageSize) {
                this.maxMessageSize = maxMessageSize;
            }

            public int getCheckThreadPoolMinSize() {
                return checkThreadPoolMinSize;
            }

            public void setCheckThreadPoolMinSize(int checkThreadPoolMinSize) {
                this.checkThreadPoolMinSize = checkThreadPoolMinSize;
            }

            public int getCheckThreadPoolMaxSize() {
                return checkThreadPoolMaxSize;
            }

            public void setCheckThreadPoolMaxSize(int checkThreadPoolMaxSize) {
                this.checkThreadPoolMaxSize = checkThreadPoolMaxSize;
            }

            public int getCheckRequestHoldMax() {
                return checkRequestHoldMax;
            }

            public void setCheckRequestHoldMax(int checkRequestHoldMax) {
                this.checkRequestHoldMax = checkRequestHoldMax;
            }
        }

        public class PushConsumer{
            private String consumerGroup;
            private String messageModel;
            private int consumeThreadMin;
            private int consumeThreadMax;
            private int consumeConcurrentlyMaxSpan;
            private int pullThresholdForQueue;
            private long pullInterval;
            private int consumeMessageBatchMaxSize;
            private int pullBatchSize;

            public String getConsumerGroup() {
                return consumerGroup;
            }

            public void setConsumerGroup(String consumerGroup) {
                this.consumerGroup = consumerGroup;
            }

            public String getMessageModel() {
                return messageModel;
            }

            public void setMessageModel(String messageModel) {
                this.messageModel = messageModel;
            }

            public int getConsumeThreadMin() {
                return consumeThreadMin;
            }

            public void setConsumeThreadMin(int consumeThreadMin) {
                this.consumeThreadMin = consumeThreadMin;
            }

            public int getConsumeThreadMax() {
                return consumeThreadMax;
            }

            public void setConsumeThreadMax(int consumeThreadMax) {
                this.consumeThreadMax = consumeThreadMax;
            }

            public int getConsumeConcurrentlyMaxSpan() {
                return consumeConcurrentlyMaxSpan;
            }

            public void setConsumeConcurrentlyMaxSpan(int consumeConcurrentlyMaxSpan) {
                this.consumeConcurrentlyMaxSpan = consumeConcurrentlyMaxSpan;
            }

            public int getPullThresholdForQueue() {
                return pullThresholdForQueue;
            }

            public void setPullThresholdForQueue(int pullThresholdForQueue) {
                this.pullThresholdForQueue = pullThresholdForQueue;
            }

            public long getPullInterval() {
                return pullInterval;
            }

            public void setPullInterval(long pullInterval) {
                this.pullInterval = pullInterval;
            }

            public int getConsumeMessageBatchMaxSize() {
                return consumeMessageBatchMaxSize;
            }

            public void setConsumeMessageBatchMaxSize(int consumeMessageBatchMaxSize) {
                this.consumeMessageBatchMaxSize = consumeMessageBatchMaxSize;
            }

            public int getPullBatchSize() {
                return pullBatchSize;
            }

            public void setPullBatchSize(int pullBatchSize) {
                this.pullBatchSize = pullBatchSize;
            }
        }
    }

    public static class Rabbitmq{}

}
